package com.yx.cloud.bean.tuya;

public class TuyaResponseBean<T> {

    /**
     * infoType : 21003
     * dInfo : {"ts":"xxxx","message":{},"userId":"yyyy"}
     */
    private int infoType;
    private T message;
    private DInfoBean dInfo;

    private TuyaResponseBean(Builder<T> builder) {
        setInfoType(builder.infoType);
        setMessage(builder.message);
        setDInfo(builder.dInfo);
    }

    public static Builder newBuilder() {
        return new Builder();
    }


    public int getInfoType() {
        return infoType;
    }

    public void setInfoType(int infoType) {
        this.infoType = infoType;
    }

    public DInfoBean getDInfo() {
        return dInfo;
    }
    public void setDInfo(DInfoBean dInfo) {
        this.dInfo = dInfo;
    }

    public T getMessage() {
        return message;
    }

    public void setMessage(T message) {
        this.message = message;
    }




    public static class DInfoBean {
        /**
         * ts : xxxx
         * userId : yyyy
         */

        private String ts;
        private String userId;

        public String getTs() {
            return ts;
        }

        public void setTs(String ts) {
            this.ts = ts;
        }

        public String getUserId() {
            return userId;
        }

        public void setUserId(String userId) {
            this.userId = userId;
        }

        @Override
        public String toString() {
            return "{" +
                    "\"ts\":\'" + ts + "\'" +
                    ", \"userId\":\'" + userId + "\'" +
                    '}';
        }
    }


    @Override
    public String toString() {
        return "{" +
                "\"infoType\":" + infoType +
                ", \"message\":" + message +
                ", \"dInfo\":" + dInfo +
                '}';
    }


    public static final class Builder<T> {
        private int infoType;
        private T message;
        private DInfoBean dInfo;

        private Builder() {
            dInfo=new DInfoBean();
        }

        public Builder setInfoType(int infoType) {
            this.infoType = infoType;
            return this;
        }

        public Builder setMessage(T message) {
            this.message = message;
            return this;
        }

        public Builder setTs(String ts) {
            dInfo.ts = ts;
            return this;
        }

        public Builder setUserId(String userId) {
            dInfo.userId = userId;
            return this;
        }

        public TuyaResponseBean build() {
            return new TuyaResponseBean(this);
        }
    }
}
